package com.gzc.just.play.last.war.common.share.communication;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Message handler registry
 */
public class MessageHandlerRegistry {
    
    private static final Map<String, MessageHandler> handlers = new ConcurrentHashMap<>();
    
    /**
     * Register message handler
     */
    public static void registerHandler(String messageType, MessageHandler handler) {
        handlers.put(messageType, handler);
    }
    
    /**
     * Get message handler
     */
    public static MessageHandler getHandler(String messageType) {
        return handlers.get(messageType);
    }
    
    /**
     * Remove message handler
     */
    public static void removeHandler(String messageType) {
        handlers.remove(messageType);
    }
}
